package net.pimpas.report.processor.projection.impl;

import net.pimpas.report.processor.exception.ProjectionException;
import net.pimpas.report.processor.projection.AbstractProjection;
import net.pimpas.report.processor.projection.ProjectionType;
import net.pimpas.report.processor.resolver.FieldPropertyResolver;

import org.hibernate.criterion.Projection;
import org.hibernate.criterion.Projections;

public class RowCountProjection extends AbstractProjection {

	private static final long serialVersionUID = 1447711160409551347L;

	public RowCountProjection() {
		super(null, ProjectionType.ROWCOUNT);
	}

	@Override
	public Projection process(String fieldAlias, FieldPropertyResolver resolver) throws ProjectionException {
		return Projections.rowCount();
	}
}